package threads;

import model.Preference;
import model.Settings;
import platform.PlatformObjectFactory;
import util.LoggingUtils;

public class PreferenceNotifierRunnable implements Runnable{
	
	//RBB
	protected final String className = this.getClass().getName();
	
	@Override
	public void run() {
		String classMethod = className + ".run()";
		LoggingUtils.logStart(classMethod);
		Preference.getInstance().save();

		if(Settings.isRestart)
		{
			Settings.isRestart = false;
			System.out.println("Memory size change and schedule restart need player to restart");
			PlatformObjectFactory.getInstance().getCommandExecutor().restartPlayer();
		}
		Preference.getInstance().notifyViews();
		LoggingUtils.logEnd(classMethod);		
	}
}
